#!/usr/bin/python

# inst_str = '''
#    booth2_pp_gen #(16+1) mul_pp%d
#      (
#       .pp_out(pp[%d]),
#       .pp_s(S[%d]),
#       .pp_e(E[%d]),
      
#       .mcand(a_mix_%d),				// multiplicand
#       .booth2(b_16_ext[%d:%d])
#       );
# '''


# for i in range(9):
#     print inst_str % (i,i,i,i, 0 if i<=4 else 1, i*2+2, i*2)

#     # if i == 0:
#     #     print inst_str % (i,i,i,i, 0, "{b_16[%d:%d], 1'b0}" % (i*2+1,i*2))
#     # elif i <= 3:
#     #     print inst_str % (i,i,i,i, 0, "b_16[%d:%d]" % (i*2+1,i*2-1))
#     # elif i==4:
#     #     print inst_str % (i,i,i,i, 0, "mode8 ? {2{i_sign & b_16[%d]}} : b_16[%d:%d]" % (i*2+1, i*2-1))

    


inst_str = '''
   booth2_pp_gen_mix #(16+1) mul_pp%d
     (
      .pp_out(pp[%d]),
      .pp_s(S[%d]),
      .pp_e(E[%d]),
      
      .mcand_sign(%s),          // the sign bit
      .mcand(a_mix_%d[15:0]),				// multiplicand, do not give the sign bit here
      .booth2(b_16_ext[%d:%d])
      );
'''


for i in range(9):
    print inst_str % (i,i,i,i, "a_mix_%d[16]" % (0 if i<=4 else 1),0 if i<=4 else 1, i*2+2, i*2)

    # if i == 0:
    #     print inst_str % (i,i,i,i, 0, "{b_16[%d:%d], 1'b0}" % (i*2+1,i*2))
    # elif i <= 3:
    #     print inst_str % (i,i,i,i, 0, "b_16[%d:%d]" % (i*2+1,i*2-1))
    # elif i==4:
    #     print inst_str % (i,i,i,i, 0, "mode8 ? {2{i_sign & b_16[%d]}} : b_16[%d:%d]" % (i*2+1, i*2-1))
